package com.newegg.nlp.test;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.newegg.nlp.AppMain;
import com.newegg.nlp.arangodb.dao.AdjectiveDao;
import com.newegg.nlp.arangodb.dao.KeywordAdjectiveDao;
import com.newegg.nlp.arangodb.dao.KeywordDao;
import com.newegg.nlp.arangodb.dao.KeywordNounDao;
import com.newegg.nlp.arangodb.dao.NounDao;
import com.newegg.nlp.arangodb.model.Adjective;
import com.newegg.nlp.arangodb.model.Keyword;
import com.newegg.nlp.arangodb.model.KeywordAdjective;
import com.newegg.nlp.arangodb.model.KeywordNoun;
import com.newegg.nlp.arangodb.model.Noun;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes=AppMain.class)
public class ArangoDemo {
	
	@Autowired
	KeywordDao keywordDao;
	
	@Autowired
	NounDao nounDao;
	
	@Autowired
	AdjectiveDao adjectiveDao;
	
	@Autowired
	KeywordAdjectiveDao keywordAdjectiveDao;
	
	@Autowired
	KeywordNounDao keywordNounDao;
	
	@Test
	public void test1() throws Exception {
		Adjective adjective = adjectiveDao.getOrCreate("very good");
		Noun noun = nounDao.getOrCreate("quality");
		
		Keyword keyword = keywordDao.getOrCreate(adjective.getName() + " " + noun.getName());
		keywordAdjectiveDao.save(new KeywordAdjective(adjective, keyword));
		keywordNounDao.save(new KeywordNoun(noun, keyword));
	}
}
